@import './styles/variables.scss';
@import './styles/mixins.scss';
@import './styles/pages.scss';

// 全局样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background-color: #f5f5f5;
}

#root {
  height: 100%;
}

// 应用全局样式
.App {
  height: 100%;
  overflow: hidden;
}

// 布局样式
.layout {
  height: 100vh;
  
  &__logo {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
    
    &--collapsed {
      font-size: 16px;
    }
  }
  
  &__trigger {
    font-size: 18px;
    cursor: pointer;
    transition: color 0.3s;
    color: #fff;
    
    &:hover {
      color: #1890ff;
    }
  }
  
  &__user {
    color: #fff;
    cursor: pointer;
    
    .ant-avatar {
      margin-right: 8px;
    }
  }
  
  &__breadcrumb {
    padding: 16px 24px 0;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
  }
  
  &__content {
    padding: 24px;
    background: #f5f5f5;
    height: calc(100vh - 64px - 48px);
    overflow-y: auto;
  }
}

// 头部样式
.ant-layout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  z-index: 1000;
}

// 侧边栏样式
.ant-layout-sider {
  box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
  
  .ant-menu {
    border-right: none;
  }
}

// 面包屑样式
.breadcrumb {
  .ant-breadcrumb-link {
    a {
      color: #1890ff;
      text-decoration: none;
      
      &:hover {
        color: #40a9ff;
      }
    }
  }
}

// 仪表盘样式
.dashboard {
  &__title {
    margin-bottom: 24px;
    color: #262626;
  }
  
  &__stats {
    margin-bottom: 24px;
  }
  
  &__content {
    margin-top: 24px;
  }
  
  .stat-card {
    transition: all 0.3s;
    
    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
  }
  
  .activity-list {
    .activity-item {
      padding: 12px 0;
      border-bottom: 1px solid #f0f0f0;
      
      &:last-child {
        border-bottom: none;
      }
    }
    
    .activity-time {
      font-size: 12px;
    }
  }
}

// 用户管理样式
.user-management {
  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
  }
  
  &__table {
    background: #fff;
    border-radius: 6px;
    
    .ant-table-thead > tr > th {
      background: #fafafa;
      font-weight: 600;
    }
  }
  
  &__modal {
    .ant-form-item {
      margin-bottom: 24px;
    }
  }
}

// 设置页面样式
.settings {
  &__card {
    max-width: 800px;
    margin: 0 auto;
  }
  
  .ant-form-item {
    margin-bottom: 24px;
  }
  
  .ant-divider {
    margin: 32px 0;
  }
}

// 404 页面样式
.not-found {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  
  .ant-result {
    text-align: center;
  }
}

// 403 页面样式
.forbidden {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  
  .ant-result {
    text-align: center;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .layout {
    &__content {
      padding: 16px;
    }
  }
  
  .dashboard {
    &__stats {
      .ant-col {
        margin-bottom: 16px;
      }
    }
  }
  
  .user-management {
    &__header {
      flex-direction: column;
      align-items: flex-start;
      gap: 16px;
    }
  }
}

// 动画效果
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// 加载状态
.loading-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 400px;
  
  .mt-16 {
    margin-top: 16px;
  }
}

// 错误状态
.error-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 400px;
}

// 空状态
.empty-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 400px;
}

// 工具类
.mt-16 {
  margin-top: 16px;
}

.mb-16 {
  margin-bottom: 16px;
}

.text-center {
  text-align: center;
}

// Ant Design 组件样式覆盖
.ant-card {
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ant-table {
  border-radius: 6px;
}

.ant-btn {
  border-radius: 4px;
}

.ant-input,
.ant-select-selector {
  border-radius: 4px;
}

// 修复表格溢出问题
.ant-table-wrapper {
  overflow-x: auto;
}

// 修复模态框样式
.ant-modal-content {
  border-radius: 8px;
}

.ant-modal-header {
  border-radius: 8px 8px 0 0;
}

// 修复下拉菜单样式
.ant-dropdown-menu {
  border-radius: 6px;
  box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
}

// 菜单样式
.ant-menu-dark {
  background: $dark-bg;
  
  .ant-menu-item-selected {
    background-color: $primary-color;
  }
}

// 卡片样式
.ant-card {
  @include border-radius;
  @include card-shadow;
}

// 表格样式
.ant-table {
  @include border-radius;
}

// 按钮样式
.ant-btn {
  @include border-radius-sm;
}

// 统计卡片样式
.stat-card {
  @include text-center;
  @include padding($spacing-lg);
  
  .ant-statistic {
    &-title {
      color: $text-color-secondary;
      font-size: $font-size-sm;
      @include margin-y($spacing-sm);
    }
    
    &-content {
      color: $text-color;
      font-size: $font-size-xxl;
      font-weight: $font-weight-semibold;
    }
  }
  
  // 响应式设计
  @include respond-to(sm) {
    @include padding($spacing-md);
    
    .ant-statistic-content {
      font-size: $font-size-xl;
    }
  }
}

// 活动列表样式
.activity-list {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  @include padding-y($spacing-md);
  border-bottom: 1px solid $border-color-base;
  
  &:last-child {
    border-bottom: none;
  }
}

.activity-time {
  color: $text-color-secondary;
  font-size: $font-size-xs;
}

// 用户管理页面样式
.user-management {
  @include fade-in;
  
  &__header {
    @include flex-between;
    @include margin-y($spacing-md);
  }
  
  &__table {
    .ant-table-thead > tr > th {
      background-color: $gray-1;
      font-weight: $font-weight-semibold;
    }
  }
  
  &__modal {
    .ant-form-item {
      @include margin-y($spacing-md);
    }
  }
}

// 仪表盘页面样式
.dashboard {
  @include fade-in;
  
  &__title {
    @include margin-y($spacing-lg);
  }
  
  &__stats {
    @include margin-y($spacing-lg);
  }
  
  &__content {
    .ant-row {
      @include margin-y($spacing-md);
    }
  }
}

// 通用工具类
.text-right {
  @include text-right;
}

.mt-24 {
  @include margin-y($spacing-lg);
}

// 加载状态样式
.loading-container {
  @include loading-container;
}

// 错误状态样式
.error-container {
  @include error-container;
}

// 空状态样式
.empty-container {
  @include empty-container;
}

// 动画效果
.fade-in {
  @include fade-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

// 主题色变量应用
.ant-btn-primary {
  background-color: $primary-color;
  border-color: $primary-color;
  
  &:hover {
    background-color: lighten($primary-color, 10%);
    border-color: lighten($primary-color, 10%);
  }
}

.ant-tag-green {
  background-color: $success-color;
  border-color: $success-color;
  color: $white;
}

.ant-tag-red {
  background-color: $error-color;
  border-color: $error-color;
  color: $white;
}

// 响应式网格系统
.responsive-grid {
  .ant-col {
    @include respond-to(sm) {
      @include margin-y($spacing-md);
    }
  }
}

// 打印样式
@media print {
  .ant-layout-sider,
  .ant-layout-header {
    @include hidden;
  }
  
  .ant-layout-content {
    @include margin(0);
    @include padding(0);
    box-shadow: none;
  }
}

// 深色模式支持（可选）
@media (prefers-color-scheme: dark) {
  .App {
    background-color: #141414;
  }
  
  .ant-layout-content {
    background-color: #1f1f1f;
    color: $white;
  }
  
  .ant-card {
    background-color: #1f1f1f;
    border-color: #303030;
  }
}

// 高对比度模式支持（可选）
@media (prefers-contrast: high) {
  .ant-btn {
    border-width: 2px;
  }
  
  .ant-input {
    border-width: 2px;
  }
}

// 减少动画模式支持（可选）
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

// 设置页面样式
.settings {
  padding: 24px;
  
  &__card {
    max-width: 800px;
    margin: 0 auto;
  }
  
  .ant-form-item {
    margin-bottom: 24px;
  }
  
  .ant-divider {
    margin: 32px 0;
  }
}

// 404 页面样式
.not-found {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  
  .ant-result {
    text-align: center;
  }
}

// 403 页面样式
.forbidden {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  
  .ant-result {
    text-align: center;
  }
}

.breadcrumb {
  .ant-breadcrumb-link {
    a {
      color: #1890ff;
      text-decoration: none;
      
      &:hover {
        color: #40a9ff;
      }
    }
  }
}

// 系统设置组件样式
.system-settings {
  .settings-button {
    font-size: 18px;
    color: #001529;
    border: none;
    background: transparent;
    
    &:hover {
      color: #1890ff;
    }
  }
}

// 登录页面样式
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  
  .login-form {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    
    .login-header {
      text-align: center;
      margin-bottom: 32px;
      
      h1 {
        font-size: 28px;
        font-weight: 600;
        color: #333;
        margin-bottom: 8px;
      }
      
      p {
        font-size: 16px;
        color: #666;
        margin: 0;
      }
    }
    
    .ant-form-item {
      margin-bottom: 24px;
    }
    
    .ant-input-affix-wrapper {
      height: 48px;
      border-radius: 6px;
      
      .ant-input {
        font-size: 16px;
      }
    }
    
    .ant-btn {
      height: 48px;
      font-size: 16px;
      font-weight: 500;
      border-radius: 6px;
    }
    
    .login-footer {
      text-align: center;
      margin-top: 24px;
      
      p {
        color: #999;
        font-size: 14px;
        margin: 0;
      }
    }
  }
}

// 滚动条样式
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

// 响应式设计
@media (max-width: 768px) {
  .login-container {
    padding: 20px;
    
    .login-form {
      padding: 30px 20px;
    }
  }
} 